package com.tc.juc.pack05;

import java.io.Serializable;

public final class Singleton implements Serializable {
    private Singleton() {
    }

    private static Singleton INSTANCE = null;

    // 分析这里的线程安全, 并说明有什么缺点
    public static synchronized Singleton getInstance() {
        if (INSTANCE != null) {
            return INSTANCE;
        }
        INSTANCE = new Singleton();
        return INSTANCE;
    }
    public Object readResolve(){
        return INSTANCE;
    }
}
